//
//  VisitorLoginView.swift
//  hweibo
//
//  Created by MoChen on 16/3/6.
//  Copyright © 2016年 MoChen. All rights reserved.
//

import UIKit
import SnapKit


class VisitorLoginView: UIView {

    //要自定义视图 首先找到入口
    override init(frame: CGRect) {
        //super
        super.init(frame: frame)
        
        //访客视图的自定义
        setUpUI()
    }
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //MARK：自定义访客视图
    private func setUpUI() {
        addSubview(circlecon)
        addSubview(largeHouse)
        
        //布局 需要相对于一个已经约束好的视图来添加 链式布局
        circlecon.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(self.snp_centerX)
            make.centerY.equalTo(self.snp_centerY).offset(-80)
        }
        
        largeHouse.snp_makeConstraints { (make) -> Void in
            make.center.equalTo(circlecon.snp_center)
        }
    }
    //懒加载子视图
    private lazy var circlecon: UIImageView = UIImageView(image:UIImage(named: "visitordiscover_feed_image_smallicon"))
    //大房子
    private lazy var largeHouse: UIImageView = UIImageView(image: UIImage(named: "visitordiscover_feed_image_house"))
    
    private lazy var tipLabal: UILabel = {
        let l = UILabel()
        l.text = "关注一些人，回到这里看看有什么惊喜"
        l.textColor = UIColor.darkGrayColor()
        l.font = UIFont.systemFontOfSize(14)
        
        //自适应大小
        l.sizeToFit()
        
        return l
    }()
    
    //登录和注册按钮
    private lazy var loginBtn: UIButton = {
        let btn = UIButton()
        //设置背景图片
        btn.setBackgroundImage(UIImage(named: "visitordiscover_feed_image_house"), forState: .Normal)
        btn.setTitle("登录", forState: UIControlState.Normal)
        btn.setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(14)
        btn.sizeToFit()
        return btn
    }()
    
    private lazy var registerBtn: UIButton = {
        let btn = UIButton()
        //设置背景图片
        btn.setBackgroundImage(UIImage(named: "common_button_white_disable"), forState: UIControlState.Normal)
        btn.setTitle("注册", forState: UIControlState.Normal)
        btn.setTitleColor(UIColor.orangeColor(), forState: UIControlState.Normal)
        btn.titleLabel?.font = UIFont.systemFontOfSize(14)
        btn.sizeToFit()
        return btn
    }()

}
